#####################################################################
# Product:      KnowledgeEngine (Plone Edition)
#
# File:         ReadableScore.py
#
# Copyright:    Copyright (c) 2004, Faulkner Technologies
#
# Author:       Brian Oliver
#
# Description:  This file defines the simple 
#               ReadableScore class/interface, that specifies that a 
#               score may be read from a component.  This is 
#               different from the Scorable interface that permits
#               a component to have a modifiable score value, 
#               editable via a property editor
#####################################################################

#####################################################################
## KnowledgeEngine Library Imports
from Common import *
from ClassInfo import ClassInfo
from PropertyDefinition import *
from PropertyTypes import *
from PropertyFormats import *
from PropertyStructures import *

#####################################################################
## Zope Library Imports
# (none)
 
#####################################################################
## Python Library Imports
# (none)


#####################################################################
## ReadableScoreInfo Class Definition
class ReadableScoreInfo(ClassInfo):
    """
        Defines the class info methods, defining information about
        the class without needing an instance of the class
    """

    #---------------------------------------------------------------#

    def isInstanceOf(self, className):
        """
            Returns if the class is an instance of the specified
            className, or implements the interface specified 
            by the className
        """

        return className == 'ReadableScore' or ClassInfo.isInstanceOf(self, className)
    
    #---------------------------------------------------------------#

    def onConfigureProperties(self):
        """
            Automatically called by the Knowledge Engine once
            the class has been loaded.  Use this method to register 
            class specific properties using the PropertyReflection interface.
            
            If this class is sub-classed, a call must be made to
            the super-class to ensure super-class properties are
            correctly registered
            
            NOTE: This method is called before ClassInfo.onAfterStartup()            
        """

        #initialise the super-class properties for reflection
        ClassInfo.onConfigureProperties(self)
            
    #---------------------------------------------------------------#

#####################################################################
## ReadableScore Class Definition
class ReadableScore:
    """
        A class to define basic properties and methods of a
        scorable component.
    """

    #---------------------------------------------------------------#

    def __init__(self):
        "Constructor for the object"    
        
        pass
    
    #---------------------------------------------------------------#
        
    def getScore(self, assessment):
        """
            ABSTRACT: Return the score of the object with the
            specified assessment.

            PRECONDITION: We assume the component for which we are
            calculating the score is shown.
        """

        return 0
        
    #---------------------------------------------------------------#


#####################################################################
## Class Initialisation
# (none)
